<%@page pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>
    <link href="/bootstrap/css/bootstrap.css" rel="stylesheet">
</head>

<style>
    .ha{
        border-radius: 25px;/*圆角*/
        opacity: 0.95 ;/*透明度*/
        text-align: center;
        color: black;
        background-color: whitesmoke;

        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: auto;
    }


</style>

<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">China Telecom</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="请输入您要办理的业务">
                </div>
                <button type="submit" class="btn btn-default">查询</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li><a onclick="queryata()">返回查询界面</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">关于系统<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="https://gitee.com/fanggaolei/ct-fang-project/tree/master">项目源码</a></li>
                        <li><a href="https://gitee.com/fanggaolei/ct-fang-project/tree/master">项目文档</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

    <!--图表组件容器 -->

    <div id="main" style="width: 800px;height:600px;" class="ha"></div>



    <script>
        // 声明方法
        function queryata() {
            window.location.href = "/query;"
        }
    </script>



    <script src="/jquery/jquery-2.1.1.min.js"></script>
    <script src="/bootstrap/js/bootstrap.js"></script>
    <script src="/jquery/echarts.min.js"></script>
    <script>
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));

        option = {
            title : {
                text: '用户通话统计',
            },
            tooltip : {
                trigger: 'axis'
            },
            legend: {
                data:['通话次数','通话时长']
            },
            toolbox: {
                show : true,
                feature : {
                    dataView : {show: true, readOnly: false},
                    magicType : {show: true, type: ['line', 'bar']},
                    restore : {show: true},
                    saveAsImage : {show: true}
                }
            },
            calculable : true,
            xAxis : [
                {
                    type : 'category',
                    data : [
                        <c:forEach items="${calllogs}" var="calllog" >
                        ${calllog.dateid},
                        </c:forEach>
                    ]
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'通话次数',
                    type:'bar',
                    data:[
                        <c:forEach items="${calllogs}" var="calllog" >
                        ${calllog.sumcall},
                        </c:forEach>
                    ],
                    markPoint : {
                        data : [
                            {type : 'max', name: '最大值'},
                            {type : 'min', name: '最小值'}
                        ]
                    },
                    markLine : {
                        data : [
                            {type : 'average', name: '平均值'}
                        ]
                    }
                },
                {
                    name:'通话时长',
                    type:'bar',
                    data:[
                        <c:forEach items="${calllogs}" var="calllog" >
                        ${calllog.sumduration},
                        </c:forEach>
                    ],
                    markPoint : {
                        data : [
                            {name : '年最高', value : 182.2, xAxis: 7, yAxis: 183},
                            {name : '年最低', value : 2.3, xAxis: 11, yAxis: 3}
                        ]
                    },
                    markLine : {
                        data : [
                            {type : 'average', name : '平均值'}
                        ]
                    }
                }
            ]
        };

        myChart.setOption(option);
    </script>
</body>
</html>